<template>
  <div>
    <p class="tit">你可能也喜欢</p>
    <ul>
      <router-link
        tag="li"
        :to="{ name: 'radiostationdetail', query: { id: item.id } }"
        class="itembox"
        v-for="item in dataList"
        :key="item.id"
      >
        <img :src="item.picUrl" class="itemImg" alt="" />
        <div class="itemRightBox">
          <p class="title">{{ item.name }}</p>
          <p class="nickname">{{ item.dj.nickname }}</p>
        </div>
      </router-link>
    </ul>
  </div>
</template>

<script>
import { radioStationLike } from "@/api";
export default {
  props: {
    categoryId: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      dataList: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      radioStationLike({ cateId: this.categoryId, limit: 10 }).then((res) => {
        this.dataList = res.djRadios;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.tit {
  color: #333;
  height: 23px;
  margin-bottom: 20px;
  border-bottom: 1px solid #ccc;
  font-weight: 700;
}
.itembox {
  display: flex;
  margin-bottom: 15px;
  .itemImg {
    width: 50px;
    height: 50px;
    margin-right: 10px;
  }
  .itemRightBox {
    overflow: hidden;
    .title {
      font-size: 14px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      line-height: 24px;
    }
    .nickname {
      line-height: 24px;
      overflow: hidden;
      text-overflow: ellipsis;
      color: #666;
      white-space: nowrap;
    }
  }
}
</style>